-
Notifications
You must be signed in to change notification settings - Fork 5
RDR1 PC .WSC support #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
allows easier matching between recompiled RDR scripts (sometimes RDR scripts change PushString "" to PushStringNull, and sometimes they don't, best to disasm whatever was there originally so we can reassemble the same way)
mostly seems to assemble to same code as original, other than switch statements having some cases moved around, and the script RDRHeader being moved for some reason
seems statics always have to be big-endian just like code values fixed switch cases being switched after recompiling, script mostly matches original fine now, only difference seems to be RDRHeader location which doesn't seem to matter changed zstd compression level to 6 to match magicrdr
|
Unfortunately seems compiling larger scripts has issues, if I try recompiling content.rpf/content/release64/main.wsc the game just gets stuck on loading screen, seems there's a lot of differences between the OG and recompiled script too (even if I keep nops included with |
|
Add me on discord "NativeFunction" and send me the regular main.wsc decompiled and the decompiled-recompiled main.wsc decompiled. |
recompiling using value from std::format allows RDR1 bytecode to match pretty much 1:1 with OG
|
Oh might have found the issue, the statics were getting placed between two pages, started near the end of one page and then spilled onto the next Not sure if natives also have that issue but added the same pad code for those as well, wonder what might happen if a script has more than 1 page worth of natives/statics though... Anyway recomp seems fine now, code bytes are actually 100% identical between them (when using -dcn), only difference now seems to be RDRHeader/statics/natives being placed at different offset, which I guess game doesn't have issue with |
padding statics seems to fix main.wsc failing to load properly
Hi, thanks for the work on RASM, was looking for an RDR script dis/assembler for a while and this was perfect, so tried looking into adding RDR1 PC support to it.
First try was a bit messy, tried changing readers to little-endian and then adding a bunch of endian-swaps to each of the opcodes, only then realized it's just the RSC/RDRHeader that changed to LE while code itself stayed BE, so redid it with just a couple changes to the header reading, and with that it seemed to work fine.
Also added some new opcodes which I guess were added in NSW/PC, not really sure what their purpose is yet other than the names - tested decompiling/recompiling a couple scripts and they seemed to run fine in-game, script changes also seemed to work fine too.
I've just changed the existing DecompileRDR/CompileRDR for this, didn't add separate PC classes, if you want me to change anything here let me know.